/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.me.service;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author Administrator
 */
public class App {

    public static void main(String[] args) {
        testSingletonProtoType();
    }

    @Test
    public static void testSingletonProtoType() {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("testScope.xml");
        SingletonScope singletonScope1 = ctx.getBean("singletonScope", SingletonScope.class);
        SingletonScope singletonScope2 = ctx.getBean("singletonScope", SingletonScope.class);
        PrototypeScope prototypeScope1 = ctx.getBean("prototypeScope", PrototypeScope.class);
        PrototypeScope prototypeScope2 = ctx.getBean("prototypeScope", PrototypeScope.class);
        singletonScope1.printID();
        singletonScope2.printID();

        prototypeScope1.printID();
        prototypeScope2.printID();
    }
}
